package top.chmin.project.cloud.common.config.auto;

// field import auto
// #bind.field.id#

import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;
import top.chmin.project.cloud.common.entity.*;

/**
 * chmin
 * 2023-12-27 14:44:36
 * cloud-builder
 */
@Getter
@Setter
@Accessors(chain = true)
public class Config extends Model {

    // field auto
// #bind.field.configCode#
    // 配置编码
    private String configCode;
// $bind.field.configCode$

    // #bind.field.configName#
    // 配置名称
    private String configName;
// $bind.field.configName$

    // #bind.field.javaPath#
    // JAVA地址
    private String javaPath;
// $bind.field.javaPath$

    // #bind.field.uiPath#
    // ui路径
    private String uiPath;
// $bind.field.uiPath$


    @Override
    public ConfigEPC getPreCondition() {
        return new ConfigEPC();
    }

    public class ConfigEPC extends PreCondition {
        private ConfigEPC() {
        }

        private ConfigEPC(ConfigEPC parent) {
            super(parent);
        }

        public ConfigEPC forUpdate() {
            addUpdateSql("update_time = ?", updateTime);
            addUpdateSql("update_by = ?", updateBy);
// field update auto
// #bind.field.configCode#
            addUpdateSql("config_code = ?", configCode);
// $bind.field.configCode$

// #bind.field.configName#
            addUpdateSql("config_name = ?", configName);
// $bind.field.configName$

// #bind.field.javaPath#
            addUpdateSql("java_path = ?", javaPath);
// $bind.field.javaPath$

// #bind.field.uiPath#
            addUpdateSql("ui_path = ?", uiPath);
// $bind.field.uiPath$

            type = "UPDATE";
            return this;
        }

        public ConfigEPC forDelete() {
            type = "DELETE";
            return this;
        }

        public ConfigEPC forCount() {
            type = "COUNT";
            return this;
        }

        public ConfigEPC sub() {
            return new ConfigEPC(this);
        }

        public ConfigEPC complete(boolean and) {
            finish(and);
            return parent == null ? this : (ConfigEPC) parent;
        }

        public ConfigFPC toFlex() {
            ConfigFPC flex = new ConfigFPC();
            flex.setUpdateSqlList(updateSqlList);
            flex.setUpdateValueList(updateValueList);
            flex.setSqlList(sqlList);
            flex.setValueList(valueList);
            flex.setType(type);
            return flex;
        }

        public Condition toCondition() {
            return toCondition(Config.class, "bs_config");
        }

        // field epc auto
// #bind.field.id#
        public Id id() {
            return new Id();
        }

        // #bind.field.uiPath#
        public UiPath uiPath() {
            return new UiPath();
        }
// $bind.field.id$

        // #bind.field.createBy#
        public CreateBy createBy() {
            return new CreateBy();
        }

        public class Id extends LongEPCField<ConfigEPC> {
            private Id() {
                super(ConfigEPC.this, "id", id);
            }
        }
// $bind.field.createBy$

        // #bind.field.updateBy#
        public UpdateBy updateBy() {
            return new UpdateBy();
        }

        public class CreateBy extends StringEPCField<ConfigEPC> {
            private CreateBy() {
                super(ConfigEPC.this, "create_by", createBy);
            }
        }
// $bind.field.updateBy$

        // #bind.field.createTime#
        public CreateTime createTime() {
            return new CreateTime();
        }

        public class UpdateBy extends StringEPCField<ConfigEPC> {
            private UpdateBy() {
                super(ConfigEPC.this, "update_by", updateBy);
            }
        }
// $bind.field.createTime$

        // #bind.field.updateTime#
        public UpdateTime updateTime() {
            return new UpdateTime();
        }

        public class CreateTime extends LocalDateTimeEPCField<ConfigEPC> {
            private CreateTime() {
                super(ConfigEPC.this, "create_time", createTime);
            }
        }
// $bind.field.updateTime$

        // #bind.field.configCode#
        public ConfigCode configCode() {
            return new ConfigCode();
        }

        public class UpdateTime extends LocalDateTimeEPCField<ConfigEPC> {
            private UpdateTime() {
                super(ConfigEPC.this, "update_time", updateTime);
            }
        }
// $bind.field.configCode$

        // #bind.field.configName#
        public ConfigName configName() {
            return new ConfigName();
        }

        public class ConfigCode extends StringEPCField<ConfigEPC> {
            private ConfigCode() {
                super(ConfigEPC.this, "config_code", configCode);
            }
        }
// $bind.field.configName$

        // #bind.field.javaPath#
        public JavaPath javaPath() {
            return new JavaPath();
        }

        public class JavaPath extends StringEPCField<ConfigEPC> {
            private JavaPath() {
                super(ConfigEPC.this, "java_path", javaPath);
            }
        }
// $bind.field.javaPath$

        public class ConfigName extends StringEPCField<ConfigEPC> {
            private ConfigName() {
                super(ConfigEPC.this, "config_name", configName);
            }
        }

        public class UiPath extends StringEPCField<ConfigEPC> {
            private UiPath() {
                super(ConfigEPC.this, "ui_path", uiPath);
            }
        }
// $bind.field.uiPath$

    }
}
